import sys
import os

# 从当前目录导入send_mail模块
from .send_mail import send_analysis_email

def send_fault_report(sender_email, sender_password, recipients, cc_recipients, input_file):
    """发送故障报告邮件"""
    try:
        # 调用send_mail.py中的函数发送邮件
        send_analysis_email(
            sender_email=sender_email,
            sender_password=sender_password,
            recipients=recipients,
            cc_recipients=cc_recipients,
            input_file=input_file
        )
        return {"status": "success", "message": "邮件发送成功"}
    except Exception as e:
        return {"status": "error", "message": f"邮件发送失败: {str(e)}"}